package com.csnf.controller;

import com.csnf.entity.Category;
import com.csnf.service.impl.CategoryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController

@RequestMapping("/category")
public class CateryController {
    @Autowired
    private CategoryServiceImpl categoryService; // 注入服务层实例

    @RequestMapping("/add")
    public String addCategory(@RequestBody Category category) {
        boolean  insert = categoryService.save(category);
        if (insert==true){
            return "添加成功";
        }else {
            return "添加失败";
        }
    }
}
